export default{
    data(){
        return {
            dlgVisible:false,
            resolve:null,
            reject:null,
            title:''
        }
    },
    methods:{
        show(){
            if( this.onShow ){
                this.onShow(...arguments);
            }
            this.dlgVisible = true;
            const that = this;
            return new Promise(function(resolve, reject) {
                that.resolve = resolve;
                that.reject = reject;
            });
        },
        handleClose(action){

            if(action == 'ok'){
                this.onOk();
            }else{
                this.closeDialog(action);
            }
        },
        closeDialog(){
            this.resolve(...arguments);
            this.dlgVisible = false;
        }
    }
}